<template>
  <view class="wrap">
     <top-tab tabTitle="我的钱包" @backClick="backClick" backColor="#5B2177"/>
		 <view class="money-back-box">
			<view class="backg-money">
				<view class="title-money">可提现金额</view>
				<view class="money">￥1000.00 CNY</view>
			</view>
		 </view>
		 <!-- 选项卡 -->
		 <view class="tabs-box">
		 	<ms-tabs :list="list" v-model="active" itemColor='#A912E7' lineColor='#A912E7'/>
		 </view>
		 <!-- 列表 -->
		 <scroll-view class="main-scroller" :style="{height:navHeight+'px'}" scroll-y="true" scroll-with-animation="true">
				<view class="main">
					 <view class="record-list" v-for="(item,index) in moneyList" :key="item.id">
						<view class="title-num">
							<view class="title">{{item.title}}</view>
							<view class="money">{{item.money}}</view>
						</view>
						<view class="hint">{{item.text}}</view>
						<view class="time-failed">
							<view class="time">{{item.time}}</view>
							<view class="failed" v-if="!item.status">失败</view>
							<view class="failed" style="color: #12E794;" v-else>成功</view>
						</view>
					 </view>
				</view>
			</scroll-view>
		 <view class="footer">
			 <view class="btn-depo">提现</view>
			 <view class="btn-topup">充值</view>
		 </view>
  </view>
</template>

<script>
	import topTab from '@/components/top-tabbar.vue'
	import msTabs from '@/components/ms-tabs.vue'
  export default {
		components: { topTab, msTabs },
    data() {
      return {
				navHeight: 0, // 主体内容高度
				windoHeight: 0, // 可见高度
				active: 0,
					list:[{ title:'提现记录', value: 1 }, { title:'充值记录', value: 2 },],
					moneyList: [
						{ id: 1, title: '申请提现', money: '+999', text: '成功提现到招行', time: '2021-8-31', status: 0},
						{ id: 2, title: '申请提现', money: '+9', text: '成功提现到招行', time: '2021-8-24', status: 1},
						{ id: 3, title: '申请提现', money: '+20', text: '成功提现到招行', time: '2021-8-14', status: 0},
						{ id: 4, title: '申请提现', money: '+41', text: '成功提现到招行', time: '2021-8-4', status: 1},
						{ id: 5, title: '申请提现', money: '+10', text: '成功提现到招行', time: '2021-7-27', status: 1},
						{ id: 6, title: '申请提现', money: '+365', text: '成功提现到招行', time: '2021-7-20', status: 0},
						{ id: 7, title: '申请提现', money: '+1999', text: '成功提现到招行', time: '2021-7-11', status: 0},
						{ id: 8, title: '申请提现', money: '+10111', text: '成功提现到招行', time: '2021-6-30', status: 1},
						{ id: 9, title: '申请提现', money: '+10', text: '成功提现到招行', time: '2021-6-22', status: 0},
						{ id: 10, title: '申请提现', money: '+15', text: '成功提现到招行', time: '2021-5-10', status: 1},
					]
			}
    },
  onShow() {},
		mounted() {
				const vm = this;
				uni.getSystemInfo({ //调用uni-app接口获取屏幕高度
					success(res) { //成功回调函数
						vm.windoHeight = res.windowHeight //windoHeight为窗口高度，主要使用的是这个
						let titleH = uni.createSelectorQuery().select(".main-scroller")
						titleH.boundingClientRect(data=>{
							vm.navHeight = vm.windoHeight - data.top - 85 //计算高度：元素高度=窗口高度-元素距离顶部的距离（data.top）
						}).exec()
					}
				})
			},
  methods: {
		// 返回上一页
		backClick() {
			uni.navigateTo({
			    url: '/pages/my/agency/agency'
			});
		}
	}
}
</script>

<style lang="scss" scoped>
	.money-back-box{
		padding: 37rpx;
		.backg-money{
			width: 100%;
			height: 270rpx;
			background: linear-gradient(45deg, #FF5023 0%, #C758EC 98%);
			box-shadow: 0px 8rpx 16rpx 0px rgba(124, 133, 236, 0.28);
			border-radius: 20rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			padding-left: 40rpx;
			box-sizing: border-box;
			// align-items: center;
			.title-money{
				font-size: 30rpx;
				font-family: PingFang SC;
				color: #FFFFFF;
			}
			.money{
				margin-top: 10rpx;
				font-size: 50rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
			}
		}
	}
	.tabs-box{
		height: 100rpx;
		border-bottom: 1px solid #F2F2F2;
		line-height: 100rpx;
		/deep/ .tab{
			height: 96rpx !important;
			line-height: 96rpx !important;
		}
		/deep/ .tab__line {
			height: 6rpx !important;
		}
		/deep/ .tab__item {
			line-height: 96rpx !important;
		}
		/deep/ .tab__item-title {
			margin: 0 35rpx !important;
		}
	}
	.main{
		padding: 40rpx 30rpx;
		.record-list{
			width: 100%;
			background: #FFFFFF;
			box-shadow: 0px 8px 16px 0px rgba(124, 133, 236, 0.28);
			padding: 34rpx 20rpx 43rpx 30rpx;
			box-sizing: border-box;
			margin-bottom: 20rpx;
			.title-num{
				display: flex;
				justify-content: space-between;
				align-items: center;
				.title{
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
				}
				.money{
					font-size: 40rpx;
					font-family: Arial;
					font-weight: 400;
					color: #FE3035;
				}
			}
			.hint{
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #999999;
				margin: 34rpx 0 28rpx 0;
			}
			.time-failed{
				display: flex;
				align-items: center;
				justify-content: space-between;
				.time{
					font-size: 20rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #999999;
				}
				.failed{
					font-size: 26rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #ED2E2E;
				}
			}
		}
	}
	.footer{
		width: 100%;
		height: 140rpx;
		position:fixed;
		left: 0;
		bottom: 0;
		background: #FFFFFF;
		box-shadow: -8px -1px 13px 0px rgba(0, 0, 0, 0.08);
		display: flex;
		align-items: center;
		justify-content: center;
		margin-bottom:  env(safe-area-inset-bottom);
		font-size: 30rpx;
		color: #333333;
		.btn-depo{
			width: 220rpx;
			height: 80rpx;
			background: #E9E9E9;
			border-radius: 40rpx;
			line-height: 40px;
			text-align: center;
		}
		.btn-topup{
			width: 220rpx;
			height: 80rpx;
			background: linear-gradient(90deg, #B83DF1, #852CAE);
			border-radius: 40rpx;
			line-height: 40px;
			text-align: center;
			color: #FEFEFE;
			margin-left: 40rpx;
		}
	}
</style>
